﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using AltimilliaLibrary.Base_Object;
using Microsoft.Xna.Framework;

namespace AltimilliaLibrary.ScreenManagement
{
    public abstract class GameScreen : IAltimilliaGameComponent
    {
        public enum GameScreenState
        {
            Active, UnActive, RunningInBackGround, Frozen
        }

        private List<BaseManager> Managers;

        public GameScreen()
        {
            Managers = new List<BaseManager>();
        }

        public void AddManager(BaseManager BManager)
        {
            this.Managers.Add(BManager);
        }

        public ScreenManager ScreenManager
        {
            get
            {
                return (ScreenManager)Manager;
            }
            set
            {
                Manager = value;
            }
        }
        public GameScreenState ScreenState { get; set; }
        public BaseManager Manager { get; set; }
        public int UpdateOrder { get; set; }
        public bool Enabled { get; set; }
        public event EventHandler EnabledChanged;
        public event EventHandler UpdateOrderChanged;
        public int DrawOrder { get; set; }
        public event EventHandler DrawOrderChanged;
        public bool Visible { get; set; }
        public event EventHandler VisibleChanged;

        public virtual void Update(Microsoft.Xna.Framework.GameTime gameTime)
        {
            foreach (BaseManager mana in Managers)
            {
                mana.Update(gameTime);
            }
        }
        public virtual void Initialize()
        {
            foreach (BaseManager mana in Managers)
            {
                mana.Initialize();
            }
        }
        public virtual void Draw(Microsoft.Xna.Framework.GameTime gameTime)
        {
            foreach (BaseManager mana in Managers)
            {
                mana.Draw(gameTime);
            }
        }


    }
}
